<?php if (!defined('THINK_PATH')) exit();?><!doctype html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <link rel="stylesheet" href="/public/statics/css/swiper.min.css"/>
    <link rel="stylesheet" href="/public/statics/css/common.css"/>
    <link rel="stylesheet" href="/public/statics/css/css.css"/>
    <script src="/public/statics/js/jquery.min.js"></script>
    <script src="/public/statics/js/swiper.jquery.min.js"></script>
    <!--下面紧接title start-->
    <title>登录</title>
<!--上面紧接title end-->
</head>
<body>
<!--header-->
<header>
    <div class="header_top main">
        <a href="<?php echo U('Index/index');?>"><img class="header_logo" src="/public/statics/images/logo.png" width="135" height="30" alt=""/></a>
       <div class="header_slogan"> 一图一创新，一图一世界</div>
        <div class="header_search"><input class="text" type="text" placeholder="搜多关键字"/><input class="ser_btn" type="button" value="搜索"/></div>

        <?php if(session("tel")){ ?>

            <div class="header_my">
                <a class="photo" href="<?php echo U('My/index');?>"><img src="/public/statics/images/photo.png" alt=""/></a>
                <a class="msg" href="<?php echo U('My/msg');?>"><img src="/public/statics/images/xx.png" alt=""/></a>
                <a href="<?php echo U('Register/loginOut');?>" style="background: none; padding:0; font-size: 12px;">退出</a>
            </div>

        <?php }else{ ?>

            <div class="header_login"><a href="<?php echo U('Register/login');?>">登录</a>&nbsp;&nbsp;|&nbsp;&nbsp;<a href="<?php echo U('Register/register');?>">注册</a></div>

        <?php } ?>

    </div>
    <div class="header_nav">
        <div class="main">
            <a href="<?php echo U('Index/index');?>" class="<?php if($nav == 1){echo 'on';} ?>">首页</a>
            <a href="<?php echo U('Index/hot');?>" class="<?php if($nav == 2){echo 'on';} ?> pr">热门 <img class="nav_hot" src="/public/statics/images/hot.png" width="37" height="17" alt=""/></a>
            <a href="<?php echo U('Index/info');?>" class="<?php if($nav == 3){echo 'on';} ?>">资讯</a>
            <a href="<?php echo U('Index/tech');?>" class="<?php if($nav == 4){echo 'on';} ?>">科技</a>
            <a href="<?php echo U('Index/life');?>" class="<?php if($nav == 5){echo 'on';} ?>">生活</a>
            <a href="<?php echo U('Index/fund');?>" class="<?php if($nav == 6){echo 'on';} ?>">基金</a>
            <a href="<?php echo U('Index/tel');?>" class="<?php if($nav == 7){echo 'on';} ?>">联系我们</a>
        </div>
    </div>
</header>
<!--header end-->
<!--header end-->
<div class="login_top">
    <form action="<?php echo U('Register/doLogin');?>" method="post">
    <div class="login_center">
        <div class="llogo tc pb10"><img src="/public/statics/images/dlogo.png" width="147" height="54" alt=""/></div>
        <div class="tips none">输入错误，请重试</div>
        <div class="inpout"><input type="text" id="tel" name="tel" required placeholder="输入手机号"/></div>
        <div class="inpout"><input type="password" id="pass" name="pass" required placeholder="输入密码"/></div>
        <div class="wjmm tr"><a href="<?php echo U('Register/forget');?>">忘记密码</a></div>
        <div class="btn"><input id="login" type="button" value="登录"/></div>
        <div class="reg"><span>没有账号？</span><a href="<?php echo U('Register/register');?>">注册</a></div>
        <div class="stit">第三方账号登陆</div>
        <div class="sanf">
            <a href="javascript:;"><img src="/public/statics/images/swx.png" alt=""/></a>
            <a href="javascript:;"><img src="/public/statics/images/sqq.png" alt=""/></a>
        </div>
    </div>
    </form>
</div>
<!--footer-->
<footer>
    <div class="main pr">
        <div class="saoDown">
            <div class="saoMa"><img src="/public/statics/images/ma.png" width="150" height="151" alt=""/></div>
            <div class="saotxt tc">[扫描下载APP]</div>
        </div>
        <div class="fot_top oh">
            <div class="fot_left f12 fl">
                <h2 class="f16 pb20">联系我们</h2>
                <p><span>电话：</span>400-88888888</p>
                <p><span>传真：</span>022-8888888</p>
                <p><span>邮箱：</span>service@tu.com</p>
            </div>
            <div class="fot_right fl">
                <h2 class="f16 pb10">关于我们</h2>
                <div class="fot_block f12">
                    <div style="padding-left: 22px; padding-top: 16px;">
                        <span style="color: #ee1c25;">一图一创新,一图一世界。</span>用户上传自己的创新案例,或分享发现的创新案例,并有良好的交互。<br />
                        碎片时代,全图片模式,较少阅读量;<br />
                        让眼球凝聚创新,让时间实现价值;<br />
                        每月每年会评选优秀创新奖,并发放奖励;
                    </div>
                </div>
            </div>
        </div>
        <div class="fot_bot f12">Copyright©2011-2017 tu365.com All Rights Reserved  版权所有∙ 天津创新世界有限公司</div>
    </div>
</footer>
<!--footer end-->
<script>
    $("#tel").blur(function(){
        var val = $(this).val();
        if(val == ""){
            $(".tips").hide();
        }else{
            var reg = /^1[34578]\d{9}$/;
            var isTrue = reg.test(val);
            if(!isTrue){
                $(".tips").text("手机号格式不正确").show();
            }else{
                $(".tips").hide();
            }
        }
    });
    $("#pass").blur(function(){
        var val = $(this).val();
        if(val == ""){
            $(".tips").hide();
        }else{
            var reg = /^[\w1-9_]{3,9}$/;
            var isTrue = reg.test(val);
            if(!isTrue){
                $(".tips").text("密码格式不正确").show();
            }else{
                $(".tips").hide();
            }
        }
    });
    //实现不跳转登录
    $("#login").click(function(){
        var tel = $("#tel").val();
        var pass = $("#pass").val();
        if(tel && pass && $('.tips').is(':hidden')){
            $.ajax({
                url:"<?php echo U('Register/doLogin');?>",
                type:"post",
                async:true,
                data:{
                    "tel":tel,
                    "pass":pass
                },
                //dataType:"json", 如果返回的不是json时，不要设置
                success:function(data){
                    console.log(data);
                    if(data == 1){
                        var con = confirm("登录成功！跳转首页。");
                        if(con){
                            //点击确认则跳转首页
                            location.href = "<?php echo U('Index/index');?>";
                        }else{
                            //点击取消则取消

                        }
                    }else if(data == 2){
                        var con = confirm("登录失败,账号密码不符。");
                        if(con){
                            //点击确认则跳转首页
                        }else{
                            //点击取消则取消

                        }
                    }
                }
            })
        }

    });
</script>
</body>
</html>